// 维修工单系统全局样式

// ==================== 主题色 ====================
$primary-color: #1989fa;
$success-color: #07c160;
$warning-color: #ff976a;
$danger-color: #ee0a24;
$gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
$gradient-blue: linear-gradient(135deg, #1989fa 0%, #0e6fd6 100%);
$gradient-green: linear-gradient(135deg, #07c160 0%, #05a050 100%);

// ==================== 全局动画 ====================
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

// ==================== 工具类 ====================
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

.fade-in-down {
  animation: fadeInDown 0.5s ease-out;
}

.slide-in-left {
  animation: slideInLeft 0.5s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.5s ease-out;
}

.scale-in {
  animation: scaleIn 0.5s ease-out;
}

// ==================== 按钮增强 ====================
.btn-gradient-primary {
  background: $gradient-primary;
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s;
  
  &:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  }
}

.btn-gradient-blue {
  background: $gradient-blue;
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(25, 137, 250, 0.3);
  transition: all 0.3s;
  
  &:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(25, 137, 250, 0.3);
  }
}

.btn-gradient-green {
  background: $gradient-green;
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
  transition: all 0.3s;
  
  &:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3);
  }
}

// ==================== 卡片增强 ====================
.card-elevated {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
  
  &:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
  }
}

.card-gradient-border {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 2px;
  
  &::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 2px;
    background: $gradient-primary;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
  }
}

// ==================== 标题装饰 ====================
.title-decorated {
  position: relative;
  padding-left: 12px;
  font-weight: 600;
  
  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: $gradient-primary;
    border-radius: 2px;
  }
}

// ==================== 加载骨架屏 ====================
.skeleton {
  background: linear-gradient(
    90deg,
    #f2f2f2 25%,
    #e6e6e6 50%,
    #f2f2f2 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  @extend .skeleton;
  height: 16px;
  margin-bottom: 8px;
  
  &:last-child {
    width: 60%;
    margin-bottom: 0;
  }
}

.skeleton-title {
  @extend .skeleton;
  height: 24px;
  width: 40%;
  margin-bottom: 12px;
}

.skeleton-avatar {
  @extend .skeleton;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

// ==================== 徽章增强 ====================
.badge-dot {
  position: relative;
  
  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: $danger-color;
    border-radius: 50%;
    border: 2px solid #fff;
  }
}

.badge-count {
  position: relative;
  
  &::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: $danger-color;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    border: 2px solid #fff;
  }
}

// ==================== 状态指示器 ====================
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  
  &::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
  }
  
  &.status-success {
    background: rgba(7, 193, 96, 0.1);
    color: $success-color;
    
    &::before {
      background: $success-color;
    }
  }
  
  &.status-warning {
    background: rgba(255, 151, 106, 0.1);
    color: $warning-color;
    
    &::before {
      background: $warning-color;
    }
  }
  
  &.status-danger {
    background: rgba(238, 10, 36, 0.1);
    color: $danger-color;
    
    &::before {
      background: $danger-color;
    }
  }
  
  &.status-primary {
    background: rgba(25, 137, 250, 0.1);
    color: $primary-color;
    
    &::before {
      background: $primary-color;
    }
  }
}

// ==================== 响应式工具 ====================
@media (max-width: 375px) {
  .hide-on-small {
    display: none !important;
  }
}

@media (min-width: 376px) {
  .show-on-small {
    display: none !important;
  }
}

// ==================== 安全区域适配 ====================
.safe-area-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-top {
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

// ==================== 滚动优化 ====================
.smooth-scroll {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

// ==================== 文本省略 ====================
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.text-ellipsis-3 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

// ==================== Flexbox 快捷类 ====================
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

